@import (once) "../../include/vars";
@import (once) "../../include/mixins";

:root {
    --dialog-border-radius: 6px;

    --dialog-background: #f7f8fa;
    --dialog-color: #191919;
    --dialog-border-color: #e6e6e6;
    --dialog-closer-background: inherit;
    --dialog-closer-color: inherit;
    --dialog-closer-background-hover: var(--color-alert);
    --dialog-closer-color-hover: var(--color-light);
}

.dark-side {
    --dialog-background: #2b2d30;
    --dialog-color: #dbdfe7;
    --dialog-border-color: #414245;
    --dialog-closer-background: inherit;
    --dialog-closer-color: inherit;
    --dialog-closer-background-hover: var(--color-alert);
    --dialog-closer-color-hover: var(--color-light);
}

.dialog {
    position: fixed;
    display: flex;
    flex-flow: column;
    width: min(90%, 600px);
    max-height: calc(100vh - 100px);
    height: auto;
    background-color: var(--dialog-background);
    color: var(--dialog-color);
    z-index: @z-index-modal;
    border: 1px solid var(--dialog-border-color);
    border-radius: var(--dialog-border-radius);
}

.dialog-title, .dialog-actions {
    display: flex;
}

.dialog-title {
    font-size: 1rem;
    padding: 10px 24px;
    order: 1;
    border-bottom: 1px solid var(--dialog-border-color);
    align-items: center;
    justify-content: flex-start!important;
    flex-flow: row nowrap;

    .icon {
        margin-right: 1rem;
    }

    .caption {

    }
}

.dialog-content {
    padding: 12px 24px;
    order: 2;
    font-size: 14px;
    display: block;
}

.dialog-actions {
    border-top: 1px solid var(--dialog-border-color);
    padding: 8px 16px;
    order: 3;
    display: flex;
    flex-flow: row;
    align-items: center;

    & > * {
        margin: 0 4px;
        min-width: 64px;
    }

    &.text-left {
        justify-content: flex-start;
    }
    &.text-center {
        justify-content: center;
    }
    &.text-right {
        justify-content: flex-end;
    }
}

.dialog {
    * + .dialog-content {
        margin-top: 8px;
    }
    * + .dialog-actions {
        margin-top: 8px;
    }
}

.dialog {
    .closer {
        position: absolute;
        top: 4px;
        right: 4px;
        z-index: 100;
        border: none;
        width: 24px;
        height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: var(--dialog-closer-background);
        color: var(--dialog-closer-color);
        cursor: pointer;
        border-radius: 4px;
        &::before {
            display: block;
            content: "\00d7";
            font-size: 24px;
            margin-top: -4px;
        }
        &:hover {
            background-color: var(--dialog-closer-background-hover);
            color: var(--dialog-closer-color-hover);
        }
    }
}

.dialog {
    each(@accentColors, {
        @color: "@{value}Color";

        &.@{value} {
            border: 1px solid @@color;

            .dialog-title {
                background-color: @@color;
                border-bottom-color: @@color;
                color: @white;
            }

            .dialog-actions {
                border-top-color: @@color;
            }
        }
    })

    &.light, &.yellow {
        .dialog-title {
            color: @dark;
        }
    }
}